package co.com.smart.eagle.entities;


import java.io.Serializable;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlTransient;

import java.util.List;


/**
 * The persistent class for the roles database table.
 * 
 */
@Entity
@Table(name="roles")
@NamedQuery(name="EagleSecurityRoles.findAll", query="SELECT w FROM EagleSecurityRoles w")
public class EagleSecurityRoles implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "rolename")
	private String idrol;

	//bi-directional many-to-one association to WlsSecurityResource
	@OneToMany(mappedBy="wlsSecurityRole")
	private List<EagleSecurityResources> wlsSecurityResources;
	
    @ManyToMany(mappedBy = "eagleSecurityRolesList")
    private List<EagleSecurityUsers> eagleSecurityUsersList;

	public EagleSecurityRoles() {
	}

	public String getIdrol() {
		return this.idrol;
	}

	public void setIdrol(String idrol) {
		this.idrol = idrol;
	}

	public List<EagleSecurityResources> getEagleSecurityResources() {
		return this.wlsSecurityResources;
	}

	public void setEagleSecurityResources(List<EagleSecurityResources> wlsSecurityResources) {
		this.wlsSecurityResources = wlsSecurityResources;
	}

	public EagleSecurityResources addEagleSecurityResource(EagleSecurityResources wlsSecurityResource) {
		getEagleSecurityResources().add(wlsSecurityResource);
		wlsSecurityResource.setWlsSecurityRole(this);

		return wlsSecurityResource;
	}

	public EagleSecurityResources removeEagleSecurityResource(EagleSecurityResources wlsSecurityResource) {
		getEagleSecurityResources().remove(wlsSecurityResource);
		wlsSecurityResource.setWlsSecurityRole(null);

		return wlsSecurityResource;
	}
	
    @XmlTransient
    public List<EagleSecurityUsers> getEagleSecurityUsersList() {
        return eagleSecurityUsersList;
    }

    public void setEagleSecurityUsersList(List<EagleSecurityUsers> eagleSecurityUsersList) {
        this.eagleSecurityUsersList = eagleSecurityUsersList;
    }

}